#include<iostream>
#include<unistd.h>
#include<sys/wait.h>
using namespace std;

int main()
{
  int status = 0;
  int id = fork();
  if(id == 0)
  {
    cout << "i am child process" << endl;
    sleep(5);
    exit(1);
  }
  else if(id > 0)
  {
    waitpid(-1,&status,0);
    
    int a = (status >> 8) & 0xFF;
    cout << a << endl;
    
    int b = (status >> 6) & 0x03;
    cout << b << endl;
  }
  else 
  {
    cout << "forkerr" << endl;
  }

  return 0;
}
